<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="./lib/vue-2.6.10/dist/vue.js"></script>
  <script src="./lib/vue-router.js"></script>
  <style>
    .router-link-active,.myactive {
      color: red;
      font-weight: 800;
      font-style:italic;
      font-size: 80px;
      text-decoration: underline;
      background-color: green;
    }
    .v-enter,
    .v-leave-to{
      opacity: 0;
      transform: translateX(140px);
    }
    .v-enter-active,
    .v-leave-active{
      transition: all 0.5s ease;
    }
  </style>
</head>
<body>
  <div id="app">
    <!-- <router-link  to="/login?id=10&name=zs">login</router-link> -->
    <router-link  to="/login/10">login</router-link>
    <router-link  to="/register" >register</router-link>
    <transition mode="out-in">
      <router-view></router-view>
    </transition>
    
  </div>

  <script>
    var login = {
      // template: '<h1>login component---{{$route.query.id}}---{{$route.query.name}}</h1>',
      template: '<h1>login component{{$route.params.id}}</h1>',
      data(){return{
        msg: '123'
      }},
      created() {
        console.log(this.$route.query)
      }
    }
    var register = {
      template: '<h1>register component</h1>'
    }
    var routerObj = new VueRouter({
      routes:[
        {path: '/', redirect: '/login'},
        {path: '/login/:id', component: login},
        {path: '/register', component: register},
      ],
      linkActiveClass: 'myactive'
    })
    var vm = new Vue({
      el: '#app',
      data: {},
      methods: {

      },
      router: routerObj
    })
  </script>
  
</body>
</html>